r = [{'faceId': '1e4ab4e8-b146-4d1c-b199-0244808902c6',
  'faceRectangle': {'top': 118, 'left': 144, 'width': 88, 'height': 88},
  'faceAttributes': {'smile': 0.813,
   'gender': 'male',
   'age': 19.0,
   'glasses': 'NoGlasses',
   'hair': {'bald': 0.18,
    'invisible': False,
    'hairColor': [{'color': 'brown', 'confidence': 0.95},
     {'color': 'black', 'confidence': 0.93},
     {'color': 'other', 'confidence': 0.23},
     {'color': 'blond', 'confidence': 0.23},
     {'color': 'gray', 'confidence': 0.21},
     {'color': 'red', 'confidence': 0.15},
     {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': '3649cc3a-6fea-415c-96af-216985d159d0',
  'faceRectangle': {'top': 117, 'left': 376, 'width': 64, 'height': 64},
  'faceAttributes': {'smile': 0.456,
   'gender': 'female',
   'age': 22.0,
   'glasses': 'NoGlasses',
   'hair': {'bald': 0.08,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 1.0},
     {'color': 'other', 'confidence': 0.63},
     {'color': 'brown', 'confidence': 0.46},
     {'color': 'gray', 'confidence': 0.39},
     {'color': 'blond', 'confidence': 0.03},
     {'color': 'red', 'confidence': 0.01},
     {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': 'cbb83b49-7744-4233-bf3d-3d650fe2522c',
  'faceRectangle': {'top': 41, 'left': 676, 'width': 52, 'height': 52},
  'faceAttributes': {'smile': 1.0,
   'gender': 'male',
   'age': 25.0,
   'glasses': 'ReadingGlasses',
   'hair': {'bald': 0.06,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 0.98},
     {'color': 'brown', 'confidence': 0.96},
     {'color': 'other', 'confidence': 0.22},
     {'color': 'gray', 'confidence': 0.21},
     {'color': 'red', 'confidence': 0.09},
     {'color': 'blond', 'confidence': 0.08},
     {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': 'a53220d9-d1ad-49c4-aff2-60b29d7b5395',
  'faceRectangle': {'top': 69, 'left': 445, 'width': 52, 'height': 52},
  'faceAttributes': {'smile': 1.0,
   'gender': 'female',
   'age': 23.0,
   'glasses': 'NoGlasses',
   'hair': {'bald': 0.11,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 1.0},
     {'color': 'brown', 'confidence': 0.81},
     {'color': 'other', 'confidence': 0.41},
     {'color': 'gray', 'confidence': 0.37},
     {'color': 'blond', 'confidence': 0.03},
     {'color': 'red', 'confidence': 0.02},
     {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': 'c9dab554-30b5-46ab-985a-51312dfbd1b9',
  'faceRectangle': {'top': 95, 'left': 238, 'width': 51, 'height': 51},
  'faceAttributes': {'smile': 0.981,
   'gender': 'female',
   'age': 18.0,
   'glasses': 'ReadingGlasses',
   'hair': {'bald': 0.11,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 0.98},
     {'color': 'brown', 'confidence': 0.86},
     {'color': 'other', 'confidence': 0.4},
     {'color': 'gray', 'confidence': 0.36},
     {'color': 'blond', 'confidence': 0.09},
     {'color': 'red', 'confidence': 0.08},
     {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': 'c2f4dfce-a532-47f6-b197-2aa794df5bc5',
  'faceRectangle': {'top': 94, 'left': 540, 'width': 48, 'height': 48},
  'faceAttributes': {'smile': 1.0,
   'gender': 'female',
   'age': 19.0,
   'glasses': 'NoGlasses',
   'hair': {'bald': 0.1,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 1.0},
     {'color': 'brown', 'confidence': 0.88},
     {'color': 'other', 'confidence': 0.35},
     {'color': 'gray', 'confidence': 0.33},
     {'color': 'blond', 'confidence': 0.05},
     {'color': 'red', 'confidence': 0.04},
     {'color': 'white', 'confidence': 0.0}]}}}]

# 创建字典
glasses = {}
smile = {}
hairColor = {}
age = {}
gender = {}

# 把所有人脸的值添加进字典
count = 0
while count < len(r):
    glasses["Person{}".format(count + 1)] = r[count]['faceAttributes']['glasses']
    smile["Person{}".format(count + 1)] = r[count]['faceAttributes']['smile']
    hairColor["Person{}".format(count + 1)] = r[count]['faceAttributes']['hair']['hairColor'][0]['color']
    age["Person{}".format(count + 1)] = r[count]['faceAttributes']['age']
    gender["Person{}".format(count + 1)] = r[count]['faceAttributes']['gender']
    count += 1

# 打印字典
print("眼镜：", glasses)
print("微笑指数：", smile)
print("头发颜色：", hairColor)
print("年龄：", age)
print("性别：", gender)
